package com.hex.ds.hdtp.core.app.script.transfer.converter;

import com.hex.ds.hdtp.core.app.common.enums.BasicListStatus;
import com.hex.ds.hdtp.core.app.script.transfer.dto.request.ScriptConvertTargetListRequestDto;
import com.hex.ds.hdtp.core.app.script.transfer.dto.response.ScriptConvertSourceListResponseDto;
import com.hex.ds.hdtp.core.app.script.transfer.dto.response.ScriptConvertTargetListResponseDto;
import com.hex.ds.hdtp.core.inf.script.transfer.po.ScriptConvertTargetListPo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.io.File;
import java.util.List;

@Mapper(componentModel = "spring", imports = {BasicListStatus.class})
public interface IScriptConvertTargetListConverter {

    @Mapping(target = "pkId", ignore = true)
    @Mapping(target = "convertSourceListPkId", source = "scriptConvertList.pkId")
    @Mapping(target = "convertFilePath", source = "file.parent")
    @Mapping(target = "convertFileName", source = "file.name")
    @Mapping(target = "emptyTestStatus", expression = "java(BasicListStatus.TODO.name())")
    ScriptConvertTargetListRequestDto toDto(ScriptConvertSourceListResponseDto scriptConvertList, File file);

    ScriptConvertTargetListPo toPo(ScriptConvertTargetListRequestDto scriptConvertTargetListRequestDto);

    List<ScriptConvertTargetListResponseDto> toDTOListForPo(List<ScriptConvertTargetListPo> scriptConvertTargetListPoList);

    ScriptConvertTargetListResponseDto toDTOForPo(ScriptConvertTargetListPo scriptConvertTargetListPo);
}
